// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   dealwith_ok.java

package qcs.sample;

import com.jspsmart.upload.SmartRequest;
import com.jspsmart.upload.SmartUpload;
import include.nseer_cookie.getFileLength;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class dealwith_ok extends HttpServlet
{

	public dealwith_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			javax.servlet.ServletContext context = session.getServletContext();
			SmartUpload mySmartUpload = new SmartUpload();
			mySmartUpload.setCharset("UTF-8");
			nseer_db_backup1 qcs_db = new nseer_db_backup1(dbApplication);
			if (qcs_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				mySmartUpload.initialize(pageContext);
				String file_type = getFileLength.getFileType((String)session.getAttribute("unit_db_name"));
				long d = getFileLength.getFileLength((String)session.getAttribute("unit_db_name"));
				mySmartUpload.setMaxFileSize(d);
				mySmartUpload.setAllowedFilesList(file_type);
				try
				{
					mySmartUpload.upload();
					String sqla = "";
					String sample_id = mySmartUpload.getRequest().getParameter("sample_id");
					String dealwith_tag = mySmartUpload.getRequest().getParameter("dealwith_tag");
					sqla = (new StringBuilder("update qcs_sample set dealwith_tag='")).append(dealwith_tag).append("' where sample_id='").append(sample_id).append("'").toString();
					qcs_db.executeUpdate(sqla);
					response.sendRedirect("qcs/sample/dealwith_ok.jsp?finished_tag=0");
					qcs_db.commit();
					qcs_db.close();
				}
				catch (Exception ex)
				{
					ex.printStackTrace();
					response.sendRedirect("qcs/sample/dealwith_ok.jsp?finished_tag=1");
				}
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
